﻿<%@ Page Language="C#" AutoEventWireup="true"
    Inherits="DayToDayManagement_ProductSalesStatistics" Codebehind="ProductSalesStatistics.aspx.cs" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>

    <script type="text/javascript" src="../Include/Js/SocanCode.js"></script>

    <script type="text/javascript" src="../Include/Js/PopupCalendar.js"></script>

    <script type="text/javascript" src="../Include/Js/OpenWindow.js"></script>

    <script type="text/javascript">
               function setOrderDocValue(p)
               {
                    //alert("order");
                    var products = p.split("|");
                    var id= "";
                    for(var i=0;i<products.length;i++)
                    {
                        if(i+1==products.length)
                        {
                            var product = products[i].split(",");
                            
                            if(product.length>1)
                            {
                                id = id + product[0];
                            }
                        }
                        else
                        {
                            var product = products[i].split(",");
                            
                            if(product.length>1)
                            {
                                id = id + product[0] + ",";
                            }
                        }
                    }
                    document.getElementById("hidOrderProduct").value=id;
               } 
               function setReturnDocValue(p)
               {
                //alert("return");
                    var products = p.split("|");
                    var id= "";
                    for(var i=0;i<products.length;i++)
                    {
                        if(i+1==products.length)
                        {
                            var product = products[i].split(",");
                            
                            if(product.length>1)
                            {
                                id = id + product[0];
                            }
                        }
                        else
                        {
                            var product = products[i].split(",");
                            
                            if(product.length>1)
                            {
                                id = id + product[0] + ",";
                            }
                        }
                    }
                    document.getElementById("hidReturnProduct").value=id;
               } 
               function ClearSelectedOrderProductId()
               {
                    document.getElementById("hidOrderProduct").value="";
               }
               function ClearSelectedReturnProductId()
               {
                    document.getElementById("hidReturnProduct").value="";
               }
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <div align="Justify">
          <h2>商品销售统计</h2>
            <div class="menu_bg">统计单据：<asp:DropDownList ID="dropBillType" runat="server">
                <asp:ListItem Text="全部" Value="all"></asp:ListItem>
                <asp:ListItem Text="订单" Value="order"></asp:ListItem>
                <asp:ListItem Text="退货单 " Value="return"></asp:ListItem>
            </asp:DropDownList>&nbsp; &nbsp;&nbsp; 颜色：<asp:CheckBox ID="chkColor" runat="server" />&nbsp;
            尺码：&nbsp;<asp:CheckBox ID="chkSize" runat="server" />
            <input id="hidOrderProduct" type="hidden" runat="server" />
            <input id="hidReturnProduct" type="hidden" runat="server" />
            </div>
            <div class="menu_bg3">订单查询条件：<br />
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
            发货：<asp:DropDownList ID="dropDelivery" runat="server">
                <asp:ListItem Text="" Value="-1" Selected="true">全部</asp:ListItem>
                <asp:ListItem Text="否 " Value="0"></asp:ListItem>
                <asp:ListItem Text="是 " Value="1"></asp:ListItem>
            </asp:DropDownList>
            财审：<asp:DropDownList ID="dropOrderAcheck" runat="server">
                <asp:ListItem Text="" Value="-1" Selected="true">全部</asp:ListItem>
                <asp:ListItem Text="否 " Value="0"></asp:ListItem>
                <asp:ListItem Text="是 " Value="1"></asp:ListItem>
            </asp:DropDownList>
            结算：<asp:DropDownList ID="dropOrderClear" runat="server">
                <asp:ListItem Text="" Value="-1" Selected="true">全部</asp:ListItem>
                <asp:ListItem Text="否 " Value="0"></asp:ListItem>
                <asp:ListItem Text="是 " Value="1"></asp:ListItem>
            </asp:DropDownList>
            制单日期：<asp:TextBox ID="txtOrderStartDate" runat="server" Width="100px" OnClick="getDateString(this,oCalendarChs)"></asp:TextBox>
            至<asp:TextBox ID="txtOrderEndDate" runat="server" Width="100px" OnClick="getDateString(this,oCalendarChs)"></asp:TextBox>
            选择统计商品：
            <input id="Button1" type="button" class="input_button" style="font-weight:bold;" value="..." onclick="SearchStatisticsProducts('../','orderDoc');" />&nbsp;
            <input id="Button3" type="button" class="input_button3" value="清空选择商品" onclick="ClearSelectedOrderProductId()" />
            <br /><br />
            退货单查询条件：<br />
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
            入库：<asp:DropDownList ID="dropIntoStock" runat="server">
                <asp:ListItem Text="" Value="-1" Selected="true">全部</asp:ListItem>
                <asp:ListItem Text="否 " Value="0"></asp:ListItem>
                <asp:ListItem Text="是 " Value="1"></asp:ListItem>
            </asp:DropDownList>
            财审：<asp:DropDownList ID="dropReturnAcheck" runat="server">
                <asp:ListItem Text="" Value="-1" Selected="true">全部</asp:ListItem>
                <asp:ListItem Text="否 " Value="0"></asp:ListItem>
                <asp:ListItem Text="是 " Value="1"></asp:ListItem>
            </asp:DropDownList>
            结算：<asp:DropDownList ID="dropReturnClear" runat="server">
                <asp:ListItem Text="" Value="-1" Selected="true">全部</asp:ListItem>
                <asp:ListItem Text="否 " Value="0"></asp:ListItem>
                <asp:ListItem Text="是 " Value="1"></asp:ListItem>
            </asp:DropDownList>
            制单日期：<asp:TextBox ID="txtReturnStartDate" runat="server" Width="100px" OnClick="getDateString(this,oCalendarChs)"></asp:TextBox>
            至<asp:TextBox ID="txtReturnEndDate" runat="server" Width="100px" OnClick="getDateString(this,oCalendarChs)"></asp:TextBox>
            选择统计商品：
            <input id="Button2" type="button" class="input_button" style="font-weight:bold;" value="..." onclick="SearchStatisticsProducts('../','returnDoc');" />&nbsp;
            <input id="Button4" type="button" class="input_button3" value="清空选择商品" onclick="ClearSelectedReturnProductId()" />
            </div>
            <div class="menu_bg">
            
            <asp:Button ID="btnSearch" runat="server" CssClass="input_button3" Text="开始统计" OnClick="btnSearch_Click" />
            
            <asp:Button ID="ExportExcel" runat="server" CssClass="input_button3" Text="导出" OnClick="ExportExcel_Click" /></div>
            
            <br />
            <div class="juli"><asp:DataList ID="dlistIncludeNone" runat="server" OnItemDataBound="dlistIncludeNone_ItemDataBound" CellPadding="0" EditItemIndex="0" SelectedIndex="0">
                <HeaderTemplate>
                    <table class="tb4" border="0" cellpadding="0" cellspacing="1">
                        <tr class="z1">
                            <td class="zt3">
                                单据编号
                            </td>
                            <td class="zt3">
                                发货/入库
                            </td>
                            <td class="zt3">
                                财务审核
                            </td>
                            <td class="zt3">
                                结算
                            </td>
                            <td class="zt3">
                                单据生成时间
                            </td>
                            <td class="zt3">
                                商品代码
                            </td>
                            <td class="zt3">
                                商品ERP名称
                            </td>
                            <td class="zt3">
                                商品电子商务名称
                            </td>
                            <td class="zt3">
                                数量
                            </td>
                            <td class="zt3">
                                标准单价
                            </td>
                            <td class="zt3">
                                折扣
                            </td>
                            <td class="zt3">
                                实际单价
                            </td>
                            <td class="zt3">
                                标准金额
                            </td>
                            <td class="zt3">
                                实际金额
                            </td>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr class="z2">
                        <td class="zt4">
                            <%# Eval("ID")%>
                        </td>
                        <td class="zt4">
                            <asp:CheckBox ID="CheckBox2" runat="server" Checked=' <%# Convert.ToString(Eval("SendOrReceive"))=="1"?true:false %>' Enabled="false" />
                        </td>
                        <td class="zt4">
                            <asp:CheckBox ID="CheckBox1" runat="server" Checked=' <%# Convert.ToString(Eval("Clear"))=="1"?true:false %>' Enabled="false" />
                        </td>
                        <td class="zt4">
                            <asp:CheckBox ID="CheckBox3" runat="server" Checked=' <%# Convert.ToString(Eval("Acheck"))=="1"?true:false %>' Enabled="false" />
                        </td>
                        <td class="zt4">
                            <%# Eval("CreateDate")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("CMDCODE")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("SPMC")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("CA_NAME")%>
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblQty" runat="server" Text='<%# Eval("Qty")%>'></asp:Label>
                        </td>
                        <td class="zt4">
                            <%# Eval("Sprice")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("Disc")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("Aprice")%>
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblSamt" runat="server" Text='<%# Eval("Samt")%>'></asp:Label>
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblAamt" runat="server" Text='<%# Eval("Aamt")%>'></asp:Label>
                        </td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    <tr class="z2">
                        <td class="zt4">
                            总计：
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblTotalQty" runat="server"></asp:Label>
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblTotalSamt" runat="server"></asp:Label>
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblTotalAamt" runat="server"></asp:Label>
                        </td>
                    </tr>
                    </table>
                </FooterTemplate>
            </asp:DataList></div>
            <div class="juli"><asp:DataList ID="dlistOnlyIncludeColor" runat="server" OnItemDataBound="dlistOnlyIncludeColor_ItemDataBound" CellPadding="0" EditItemIndex="0" SelectedIndex="0">
                <HeaderTemplate>
                    <table class="tb4" border="0" cellpadding="0" cellspacing="1">
                        <tr class="z1">
                            <td class="zt3">
                                单据编号
                            </td>
                            <td class="zt3">
                                发货/入库
                            </td>
                            <td class="zt3">
                                财务审核
                            </td>
                            <td class="zt3">
                                结算
                            </td>
                            <td class="zt3">
                                单据生成时间
                            </td>
                            <td class="zt3">
                                商品代码
                            </td>
                            <td class="zt3">
                                商品ERP名称
                            </td>
                            <td class="zt3">
                                商品电子商务名称
                            </td>
                            <td class="zt3">
                                颜色
                            </td>
                            <td class="zt3">
                                数量
                            </td>
                            <td class="zt3">
                                标准单价
                            </td>
                            <td class="zt3">
                                折扣
                            </td>
                            <td class="zt3">
                                实际单价
                            </td>
                            <td class="zt3">
                                标准金额
                            </td>
                            <td class="zt3">
                                实际金额
                            </td>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr class="z2">
                        <td class="zt4">
                            <%# Eval("ID")%>
                        </td>
                        <td class="zt4">
                            <asp:CheckBox ID="CheckBox3" runat="server" Checked=' <%# Convert.ToString(Eval("SendOrReceive"))=="1"?true:false %>' Enabled="false" />
                        </td>
                        <td class="zt4">
                            <asp:CheckBox ID="CheckBox5" runat="server" Checked=' <%# Convert.ToString(Eval("Clear"))=="1"?true:false %>' Enabled="false" />
                        </td>
                        <td class="zt4">
                            <asp:CheckBox ID="CheckBox4" runat="server" Checked=' <%# Convert.ToString(Eval("Acheck"))=="1"?true:false %>' Enabled="false" />
                        </td>
                        <td class="zt4">
                            <%# Eval("CreateDate")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("CMDCODE")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("SPMC")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("CA_NAME")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("ColorName")%>
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblQty" runat="server" Text='<%# Eval("Qty")%>'></asp:Label>
                        </td>
                        <td class="zt4">
                            <%# Eval("Sprice")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("Disc")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("Aprice")%>
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblSamt" runat="server" Text='<%# Eval("Samt")%>'></asp:Label>
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblAamt" runat="server" Text='<%# Eval("Aamt")%>'></asp:Label>
                        </td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    <tr class="z2">
                        <td class="zt4">
                            总计：
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblTotalQty" runat="server"></asp:Label>
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblTotalSamt" runat="server"></asp:Label>
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblTotalAamt" runat="server"></asp:Label>
                        </td>
                    </tr>
                    </table>
                </FooterTemplate>
            </asp:DataList></div>
            <div class="juli"><asp:DataList ID="dlistOnlyIncludeSize" runat="server" OnItemDataBound="dlistOnlyIncludeSize_ItemDataBound" CellPadding="0" EditItemIndex="0" SelectedIndex="0">
                <HeaderTemplate>
                    <table class="tb4" border="0" cellpadding="0" cellspacing="1">
                        <tr class="z1">
                            <td class="zt3">
                                单据编号
                            </td>
                            <td class="zt3">
                                发货/入库
                            </td>
                            <td class="zt3">
                                财务审核
                            </td>
                            <td class="zt3">
                                结算
                            </td>
                            <td class="zt3">
                                单据生成时间
                            </td>
                            <td class="zt3">
                                商品代码
                            </td>
                            <td class="zt3">
                                商品ERP名称
                            </td>
                            <td class="zt3">
                                商品电子商务名称
                            </td>
                            <td class="zt3">
                                尺码
                            </td>
                            <td class="zt3">
                                数量
                            </td>
                            <td class="zt3">
                                标准单价
                            </td>
                            <td class="zt3">
                                折扣
                            </td>
                            <td class="zt3">
                                实际单价
                            </td>
                            <td class="zt3">
                                标准金额
                            </td>
                            <td class="zt3">
                                实际金额
                            </td>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr class="z2>
                        <td class="zt4">
                            <%# Eval("ID")%>
                        </td>
                        <td class="zt4">
                            <asp:CheckBox ID="CheckBox4" runat="server" Checked=' <%# Convert.ToString(Eval("SendOrReceive"))=="1"?true:false %>' Enabled="false" />
                        </td>
                        <td class="zt4">
                            <asp:CheckBox ID="CheckBox6" runat="server" Checked=' <%# Convert.ToString(Eval("Clear"))=="1"?true:false %>' Enabled="false" />
                        </td>
                        <td class="zt4">
                            <asp:CheckBox ID="CheckBox7" runat="server" Checked=' <%# Convert.ToString(Eval("Acheck"))=="1"?true:false %>' Enabled="false" />
                        </td>
                        <td class="zt4">
                            <%# Eval("CreateDate")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("CMDCODE")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("SPMC")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("CA_NAME")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("SizeName")%>
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblQty" runat="server" Text='<%# Eval("Qty")%>'></asp:Label>
                        </td>
                        <td class="zt4">
                            <%# Eval("Sprice")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("Disc")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("Aprice")%>
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblSamt" runat="server" Text='<%# Eval("Samt")%>'></asp:Label>
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblAamt" runat="server" Text='<%# Eval("Aamt")%>'></asp:Label>
                        </td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    <tr class="z2">
                        <td class="zt4">
                            总计：
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblTotalQty" runat="server"></asp:Label>
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblTotalSamt" runat="server"></asp:Label>
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblTotalAamt" runat="server"></asp:Label>
                        </td>
                    </tr>
                    </table>
                </FooterTemplate>
            </asp:DataList></div>
            <div class="juli"><asp:DataList ID="dlistIncludeAll" runat="server" OnItemDataBound="dlistIncludeAll_ItemDataBound" CellPadding="0" EditItemIndex="0" SelectedIndex="0">
                <HeaderTemplate>
                    <table class="tb4" border="0" cellpadding="0" cellspacing="1">
                        <tr class="z1">
                            <td class="zt3">
                                单据编号
                            </td>
                            <td class="zt3">
                                发货/入库
                            </td>
                            <td class="zt3">
                                财务审核
                            </td>
                            <td class="zt3">
                                结算
                            </td>
                            <td class="zt3">
                                单据生成时间
                            </td>
                            <td class="zt3">
                                商品代码
                            </td>
                            <td class="zt3">
                                商品ERP名称
                            </td>
                            <td class="zt3">
                                商品电子商务名称
                            </td>
                            <td class="zt3">
                                颜色
                            </td>
                            <td class="zt3">
                                尺码
                            </td>
                            <td class="zt3">
                                数量
                            </td>
                            <td class="zt3">
                                标准单价
                            </td>
                            <td class="zt3">
                                折扣
                            </td>
                            <td class="zt3">
                                实际单价
                            </td>
                            <td class="zt3">
                                标准金额
                            </td>
                            <td class="zt3">
                                实际金额
                            </td>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr class="z2">
                        <td class="zt4">
                            <%# Eval("ID")%>
                        </td>
                        <td class="zt4">
                            <asp:CheckBox ID="CheckBox4" runat="server" Checked=' <%# Convert.ToString(Eval("SendOrReceive"))=="1"?true:false %>' Enabled="false" />
                        </td>
                        <td class="zt4">
                            <asp:CheckBox ID="CheckBox8" runat="server" Checked=' <%# Convert.ToString(Eval("Clear"))=="1"?true:false %>' Enabled="false" />
                        </td>
                        <td class="zt4">
                            <asp:CheckBox ID="CheckBox9" runat="server" Checked=' <%# Convert.ToString(Eval("Acheck"))=="1"?true:false %>' Enabled="false" />
                        </td>
                        <td class="zt4">
                            <%# Eval("CreateDate")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("CMDCODE")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("SPMC")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("CA_NAME")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("ColorName")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("SizeName")%>
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblQty" runat="server" Text='<%# Eval("Qty")%>'></asp:Label>
                        </td>
                        <td class="zt4">
                            <%# Eval("Sprice")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("Disc")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("Aprice")%>
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblSamt" runat="server" Text='<%# Eval("Samt")%>'></asp:Label>
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblAamt" runat="server" Text='<%# Eval("Aamt")%>'></asp:Label>
                        </td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    <tr class="z2">
                        <td class="zt4">
                            总计：
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblTotalQty" runat="server"></asp:Label>
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblTotalSamt" runat="server"></asp:Label>
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblTotalAamt" runat="server"></asp:Label>
                        </td>
                    </tr>
                    </table>
                </FooterTemplate>
            </asp:DataList></div>
        </div>
    </form>
</body>
</html>
